<?php

// Advert Wrapper
function advert_wrapper_shortcode( $atts, $content = null ) {
	
	extract( shortcode_atts( array(
			'columns' => '',
		), $atts ) );
	
	if( !isset($atts['columns']) ) {
		$ul = '<ul class="adverts-four">';
	} else {
		
		if ( $atts['columns'] != '2' ) {
			$ul = '';
		} else { 
			$ul = '<ul class="adverts-four">';
		}
		
	}		
	
	return $ul . do_shortcode($content) . '</ul>';

}

add_shortcode( 'advert_wrapper', 'advert_wrapper_shortcode' );

// Advert Items
function advert_shortcode( $atts, $content = null ) {
	
	extract( shortcode_atts( array(
			'image_url' => '',
			'link_url' => '',
			'columns' => '',
		), $atts ) );
	
	if( !isset($atts['columns']) ) {
		$output = '<li><a href="' . $atts['link_url'] . '"><img src="' . $atts['image_url'] . '" alt="" /></a></li>';
	} else {
		$output = '<a class="advert-side-wrapper" href="' . $atts['link_url'] . '"><img src="' . $atts['image_url'] . '" alt="" /></a>';
	}

	return $output;

}

add_shortcode( 'advert', 'advert_shortcode' );

?>